import Vue from 'vue';
import VueRouter from 'vue-router'

import Home from './pages/Home'
import About from './pages/About'
import Show from './pages/Show'
import NotFound from './pages/NotFoundComponent'
import ShowPosts from './pages/ShowPost'
import ShowProfile from './pages/ShowProfile'

Vue.use(VueRouter)


const router = new VueRouter({
  mode: 'history',
  routes: [
    {
      path: '/index',
      redirect: '/'
    },
    {
      path: '/home',
      // redirect: '/'
      redirect: {
        name: 'root'
      }
    },
    {
      path: '/',
      name: 'root',
      component: Home
    },
    {
      path: '/about',
      name: 'about',
      component: About
    },
    {
      path: '/:id',
      component: Show,
      children: [
        {
          path: 'profile',
          component: ShowProfile
        },
        {
          path: 'posts',
          component: ShowPosts
        }
      ]
    },
    {
      path: '*',
      component: NotFound
    },
  ]
})

export default router







